home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-19 | 1.6 KB | 59 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CTridentIdler.cp ©1993 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- // see powerplant mail for this example
-
- #include "CTridentIdler.h"
- #include "CTridentView.h"
- #include <Events.h>
-
- // ---------------------------------------------------------------------------
- // • HeartBeatMonitor
- // ---------------------------------------------------------------------------
- // Initialises the key chain monitor.
-
-
- CHeartBeatIdler::CHeartBeatIdler() :LPeriodical()
- {
- fLastHeartBeat = 0;
- fOwnerView = NULL;
- }
-
-
- // ---------------------------------------------------------------------------
- // • SpendTime
- // ---------------------------------------------------------------------------
- // This method is executed at idle time
-
- void
- CHeartBeatIdler::SpendTime(const EventRecord &/* inMacEvent */)
- {
-
- if ((fLastHeartBeat + 7200) < TickCount()) //two minutes (7200 ticks) have passed
- {
- this->fOwnerView->SendHeartBeat();
- SysBeep(1);
- }
- }
-
- // ---------------------------------------------------------------------------
- // • ResetTicks
- // ---------------------------------------------------------------------------
-
- void
- CHeartBeatIdler::ResetTicks()
- {
-
- fLastHeartBeat = TickCount();
- }
-
- // ---------------------------------------------------------------------------
- // • SetOwner
- // ---------------------------------------------------------------------------
-
- void
- CHeartBeatIdler::SetOwnerView(CTridentView* theOwner)
- {
- this->fOwnerView = theOwner;
- }
-